#include <regx52.h>
#include <intrins.h>
sbit PUT =P3^4;
sbit PULL=P3^6;
sbit PUSH=P3^5;

void Delay_1ms()		//@11.0592MHz
{

	unsigned char i, j;

	_nop_();
	_nop_();
	_nop_();
	i = 11;
	j = 190;
	do
	{
		while (--j);
	} while (--i);
}

void Lcd_Init()//初始化LCD
{
    PULL = 0;
    PUSH = 0;
}

void Lcd_Clear()//清屏，防止漏点
{
    P0 = 0xFF; // 关闭所有列
}

void Lcd_hang(unsigned char y) // 取值为0~7
//确定行坐标
{
    unsigned char Count = 0;
    unsigned char i = 0;
    Count = 0x80 >> y;
    for (i = 0; i < 8; i++)
    {
        PUT = Count & (0x80 >> i);
        PULL = 1;
        PULL = 0;
    }
    PUSH = 1;
    PUSH = 0;
}

void Lcd_Coord(unsigned char x, unsigned char y)//点亮LED坐标
{
    Lcd_Clear();
    Lcd_hang(y);
    P0 = ~(0x80 >> x);
    Delay_1ms();
}